(function () {
    axios.get('http://127.0.0.1:8092/getAumAvg', {}).then((response) => {
        var xData = ['结构性', '定期', '活期', '理财', '基金', '资管', '贷款', '大额存单']
        var yData = []
        yData = Object.values(response.data[0])
        var myChart = echarts.init(document.getElementById('myMap'))
        option = {
            color: '#00BFFF',
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true,
                height: '90%',
                width: '90%'
            },
            xAxis: [
                {
                    type: 'category',
                    data: xData,
                    axisTick: {
                        alignWithLabel: true
                    },
                    axisLine: {
                        lineStyle: {
                            color: '#fff'
                        }
                    },
                    axisLabel: {
                        interval: 0, //隔多少点显示一个X轴刻度,0就是全部显示
                    }
                }
            ],
            // dataZoom:{
            //     type: 'slider',
            //     show: true
            // },
            yAxis: [
                {
                    type: 'value',
                    min: 0,
                    max: 480000,
                    interval: 60000,
                    axisLine: {
                        lineStyle: {
                            color: '#fff'
                        }
                    }
                }
            ],
            series: [
                {
                    name: '数量',
                    type: 'bar',
                    barWidth: '40%',
                    data: yData,
                    itemStyle: {
                        normal: {
                            color: function(params) {//柱状图不同颜色实现
                                // build a color map as your need.
                                let colorList = [
                                    '#0EC4E1',
                                    '#00D5D7',
                                    '#3EE4C1',
                                    '#7EEFA3',
                                    '#BBF686',
                                    "#F9F871",
                                    '#BFFAFF',
                                    '#C8A5EA'
                                ];
                                return colorList[params.dataIndex]
                            },

                        }
                    },
                }
            ]
        };
        myChart.setOption(option)
    })
})()
